#/*
# -----------------------------------------------------------------------------
# Filename:    CMakeLists.txt
# -----------------------------------------------------------------------------
#
# This source file is part of
#  _____            ___
# /__   \__      __/___\__ _ _ __ ___
#   / /\/\ \ /\ / //  // _` | '__/ _ \
#  / /    \ V  V / \_// (_| | | |  __/
#  \/      \_/\_/\___/ \__, |_|  \___|
#                      |___/
#
#	  Ogre wrapper for the AntTweakBar GUI library
# -----------------------------------------------------------------------------
#	  TwOgre Project: http://code.google.com/p/twogregui/
#	  Ogre3D: http://www.ogre3d.org/
#     AntTweakBar: http://www.antisphere.com/Wiki/tools:anttweakbar
# -----------------------------------------------------------------------------
# TwOgre is licensed under the Simplified BSD License:
#
# Copyright (c) 2007-2011, the TwOgre Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
#   and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
#   and the following disclaimer in the documentation and/or other materials provided with the distribution.
# * Neither the name of TwOgre nor the names of its contributors may be used to endorse or promote
#   products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
#*/

cmake_minimum_required(VERSION 2.6)

cmake_policy(SET CMP0010 NEW)

project(Example_WorldEditor)

#set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")

set(HDRS
    ./Listener.h
    ./OgreApp.h
)

set(SRCS
    ./Listener.cpp
    ./OgreApp.cpp
    ./main.cpp
)

add_executable(Example_WorldEditor WIN32 ${HDRS} ${SRCS})

set_target_properties(Example_WorldEditor PROPERTIES DEBUG_POSTFIX _d)

target_link_libraries(Example_WorldEditor ${OGRE_LIBRARIES} ${OIS_LIBRARIES} twogre)

file(MAKE_DIRECTORY ${TWOGRE_BIN_DIR}/demo/bin)
file(MAKE_DIRECTORY ${TWOGRE_BIN_DIR}/demo/Media)

# post-build copy for win32
if(WIN32 AND NOT MINGW)
    add_custom_command( TARGET Example_WorldEditor POST_BUILD
        COMMAND copy \"$(TargetPath)\" ..\\bin )
endif(WIN32 AND NOT MINGW)

# set the executable output path for Unix and MinGW instead of post-build copy
if(MINGW OR UNIX)
    set(EXECUTABLE_OUTPUT_PATH ${TWOGRE_BIN_DIR}/demo/bin)
endif(MINGW OR UNIX)


install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/Media
    DESTINATION ${TWOGRE_BIN_DIR}/demo
)

if(UNIX)
    install(FILES ${CMAKE_SOURCE_DIR}/demo/bin/resources.cfg
        DESTINATION ${TWOGRE_BIN_DIR}/demo/bin
  )
endif(UNIX)

# Fix the plugins configuration file for Linux
if(UNIX)
    configure_file(${CMAKE_SOURCE_DIR}/cmake/templates/plugins.cfg.in ${TWOGRE_BIN_DIR}/demo/bin/plugins.cfg)
endif(UNIX)

if(WIN32)
    install(FILES ${CMAKE_SOURCE_DIR}/demo/bin/plugins.cfg
        ${CMAKE_SOURCE_DIR}/demo/bin/resources.cfg
        DESTINATION ${TWOGRE_BIN_DIR}/demo/bin
        CONFIGURATIONS Release RelWithDebInfo
    )

    install(FILES ${CMAKE_SOURCE_DIR}/demo/bin/plugins_d.cfg
        ${CMAKE_SOURCE_DIR}/demo/bin/resources_d.cfg
        DESTINATION ${TWOGRE_BIN_DIR}/demo/bin
        CONFIGURATIONS Debug
    )

    install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
        ${OGRE_PLUGIN_DIR_REL}/RenderSystem_Direct3D9.dll
        ${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
        ${OGRE_PLUGIN_DIR_REL}/OIS.dll
        DESTINATION ${TWOGRE_BIN_DIR}/demo/bin
        CONFIGURATIONS Release RelWithDebInfo
    )

    install(FILES ${OGRE_PLUGIN_DIR_DBG}/OgreMain_d.dll
        ${OGRE_PLUGIN_DIR_DBG}/RenderSystem_Direct3D9_d.dll
        ${OGRE_PLUGIN_DIR_DBG}/RenderSystem_GL_d.dll
        ${OGRE_PLUGIN_DIR_DBG}/OIS_d.dll
        DESTINATION ${TWOGRE_BIN_DIR}/demo/bin
        CONFIGURATIONS Debug
    )
endif(WIN32)

